package ar.com.viajes.actions;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.catalina.connector.Request;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import ar.com.viajes.dominio.Login;
import ar.com.viajes.services.ServiceFacade;
import ar.com.viajes.services.SpringUtil;

public class ListaPasajeAction extends Action {

	@Override
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {

		ServiceFacade servicio = (ServiceFacade) SpringUtil
				.getBean("serviceFacade");
		HttpSession session = request.getSession(true);
		String m = session.getAttribute("idPasaj").toString();
		
	
		
		
		System.out.println("hola" + Integer.parseInt(m));

		// Login login = (Login) SpringUtil.getBean("login");
		request.setAttribute("listaPasajes", servicio.getPasajeDao()
				.obtenerPasajeIniciado(Integer.parseInt(m)));

		// TODO Auto-generated method stub
		return mapping.findForward("success");
	}

}
